package com.game.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.game.business.domain.TOrderDbrRecord;
import com.game.common.core.domain.entity.SysUser;
import com.game.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.game.business.mapper.GroupMemberMapper;
import com.game.business.domain.GroupMember;
import com.game.business.service.IGroupMemberService;

/**
 * 群聊成员Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-15
 */
@Service
public class GroupMemberServiceImpl extends ServiceImpl<GroupMemberMapper,GroupMember>  implements IGroupMemberService
{
    @Autowired
    private GroupMemberMapper groupMemberMapper;

    @Autowired
    private ISysUserService sysUserService;


    /**
     * 查询群聊成员
     *
     * @param id 群聊成员主键
     * @return 群聊成员
     */
    @Override
    public GroupMember selectGroupMemberById(Long id)
    {
        return groupMemberMapper.selectGroupMemberById(id);
    }

    /**
     * 查询群聊成员列表
     *
     * @param groupMember 群聊成员
     * @return 群聊成员
     */
    @Override
    public List<GroupMember> selectGroupMemberList(GroupMember groupMember)
    {
        List<GroupMember> groupMembers = groupMemberMapper.selectGroupMemberList(groupMember);
        for (GroupMember groupMember1 : groupMembers) {
            SysUser sysUser1 = sysUserService.selectUserById(Long.parseLong(groupMember1.getUserId()));
            groupMember1.setUser(sysUser1);
        }
        return groupMembers;
    }

    /**
     * 新增群聊成员
     *
     * @param groupMember 群聊成员
     * @return 结果
     */
    @Override
    public int insertGroupMember(GroupMember groupMember)
    {
            return groupMemberMapper.insertGroupMember(groupMember);
    }

    /**
     * 修改群聊成员
     *
     * @param groupMember 群聊成员
     * @return 结果
     */
    @Override
    public int updateGroupMember(GroupMember groupMember)
    {
        return groupMemberMapper.updateGroupMember(groupMember);
    }

    /**
     * 批量删除群聊成员
     *
     * @param ids 需要删除的群聊成员主键
     * @return 结果
     */
    @Override
    public int deleteGroupMemberByIds(Long[] ids)
    {
        return groupMemberMapper.deleteGroupMemberByIds(ids);
    }

    /**
     * 删除群聊成员信息
     *
     * @param id 群聊成员主键
     * @return 结果
     */
    @Override
    public int deleteGroupMemberById(Long id)
    {
        return groupMemberMapper.deleteGroupMemberById(id);
    }
}
